<!DOCTYPE HTML>
<html>
  <head>
	<?php echo Yaf_View_Simple::render("header.phtml"); ?>
    <script>
     //This page global variable!
     var app = {
         article_rows : <?php echo $rows[0]; ?>,
         user_id : <?php echo $user['user_id'] ?>
     }
    </script>        
  </head>
  <body>
	<?php echo Yaf_View_Simple::render("menu.phtml"); ?>
	<div class="container">
      <div class="page-header">
        <h3><?php echo $user['user_name']; ?> log </h3>
      </div>
	  <div class="content">
        <table class="table table-condensed">
	      <thead>
		    <tr>
              <th>Date</th>
			  <th>Info</th>
		    </tr>
	      </thead>
	      <tbody id="tbody">
		    <?php foreach($log as $value) { ?>
		    <tr>
              <td><?php echo date('Y-m-d:H:s',$value['log_time']); ?></td>
			  <td><?php echo $value['log_info']; ?></td>
            </tr>
		    <?php } ?>
	      </tbody>
        </table>
     	<div class="pagination" id ="pagination">
		  <ul>
		  </ul>
		</div>
	  </div>
	</div>  
    <!-- Modal -->
    <div class="modal" id="imodal" tabindex="-1" role="dialog" aria-labelledby="modallable">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-body bg-danger">
            <p>Are you sure to remove?</p>
          </div>
          <div class="modal-footer">
            <button type="button" id="close" class="btn btn-primary">Yes</button>
          </div>          
        </div>
      </div>
    </div>        
	<?php echo Yaf_View_Simple::render("footer.phtml"); ?>
	<script src="/asset/admin/js/ajaxpage.js" type="text/javascript"></script>
    <script type="text/javascript">
     var bind = function(){
         var pagination = $("#pagination");
         var _a = pagination.find("li a");
         _a.on('click',function(){
             
             // console.log("nice");
             var page = $(this).text();
             page = parseInt(page);
             if(page == 1){
                 page = 0;
             }else{
                 page = (page-1)*10;
             }
             $.ajax({
                 type:"get",
                 url :"/admin/log/user",
                 data:{
                     id : app.user_id,
                     page : page,
                 },
                 success:function(e){
                     $("#tbody").html(e)
                     // console.log(e);
                 },
                 dataType: 'text',
             });            
         })

     }
     bind();     
    </script>
    
  </body>
</html>

